#ifndef	__CMD_H__
#define	__CMD_H__

#include "types.h"

#define	RTL8309SB		2
#define	RTL8309SCL		0
#define	RTL8309SCR		1

#define	PORT_N(c)	(1 << (c))

enum {
	VLAN_A = 0,
	VLAN_B,
	VLAN_C,
	VLAN_D,
	VLAN_E,
	VLAN_F,
	VLAN_G,
	VLAN_H,
	VLAN_I,
	VLAN_NR,
};

#define	CMD_START1	0xA5
#define	CMD_START2	0x5A
/* 0xA5 0x5A CMD LEN Data */
struct cmd {
	uint16_t magic;
#define	CMD_R	0x00
#define	CMD_W	0x01
	uint8_t cmd;
	uint8_t id;
	uint8_t phy;
	uint8_t reg;
};

enum {
	CMD_PORT_ISOLATE = 0x07,
	CMD_VIDX = 0x10,
	CMD_VMB,
};

/* set vlan index */
struct vlan_index {
	uint8_t chip;
	uint8_t phy;
	uint8_t vlan;
};

/* set vlan membership */
struct vlan_member {
	uint8_t chip;
	uint8_t vlan;
	uint8_t flag;
	uint16_t member;
};

#endif
